package org.bennedum.SimpleMCClient.protocol;

/**
 *
 * @author frdfsnlght <frdfsnlght@gmail.com>
 */
public final class Packet02 extends Packet {
    
    public Packet02(byte[] input) {
        String message = getString16(input, 1);
        setBuffer(input, 0, 3 + (2 * message.length()));
    }
 
    public Packet02(String username) {
        super(0x02, 3 + (2 * username.length()));
        setString16(buffer, 1, username);
    }
    
    public String getUsername() {
        return getString16(buffer, 1);
    }
    
    public String getConnectionHash() {
        return getUsername();
    }
    
}
